<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge">
    <meta name="viewport"
          content="width=device-width,user-scalable=no, initial-scale=1">
    <meta name="format-detection" content="telephone=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <title>服务评价</title>
    <%- include('./_global/baseLibs') %>
    <link rel="stylesheet"  href="/static/css/mycontract.css" />
</head>
<style>
    html,body {
        background: #333333;
    }
    div.pj-box > span{
        width: 6rem!important;
    }
</style>
<body>
<section class="page-wrap service-comment">
    <header class="header-box grey fixed">
        <div class="header-content">
            <div class="left-tool">
                <a class="back" href="javascript:void(0);"><i class="iconfont icon-back"></i></a>
            </div>
            <div class="title">服务评价</div>
        </div>
    </header>

    <div class="fwpj-out-box">
        <div class="fwpj-box">
            <span class="blue-span" name="fwmc"></span>
            <span>服务时间：<span name="sjfwsj"></span></span>
            <span>服务医生：<span name="fwry"></span></span>
            <span>服务内容：<span name="fwnr"></span></span>
            <div class="pj-box">
                <span>服务及时性：</span>
                <div class="star-box" name="fwjsx">
                    <ul>
                        <li><a class="star"></a></li>
                        <li><a class="star"></a></li>
                        <li><a class="star"></a></li>
                        <li><a class="star"></a></li>
                        <li><a class="star"></a></li>
                    </ul>
                </div>
            </div>
            <div class="pj-box">
                <span>服务专业性：</span>
                <div class="star-box" name="fwzyx">
                    <ul>
                        <li><a class="star"></a></li>
                        <li><a class="star"></a></li>
                        <li><a class="star"></a></li>
                        <li><a class="star"></a></li>
                        <li><a class="star"></a></li>
                    </ul>
                </div>
            </div>
            <div class="pj-box">
                <span>服务态度：</span>
                <div class="star-box" name="fwtd">
                    <ul>
                        <li><a class="star"></a></li>
                        <li><a class="star"></a></li>
                        <li><a class="star"></a></li>
                        <li><a class="star"></a></li>
                        <li><a class="star"></a></li>
                    </ul>
                </div>
            </div>
        </div>

    </div>
    <div class="pj-text-box">
        <textarea id="JYFK" ></textarea>
        <div id="tip">可描述对于服务的意见和建议，谢谢您的反馈</div>
    </div>

    <div class="tj-btn-box">
        <a id="savePjxxBtn" href="javascript:void(0)">提交</a>
    </div>
</section>
</body>
<script type="text/javascript">


    var page_fwpj = (function($, page_fwpj) {


        /**设置待评价服务基本信息*/
        function setDpjfwxx() {
            var data = StoreCache.getCache("QYFW_DPJFWXX");
            $("body").data(data);
            StoreCache.removeCache("QYFW_DPJFWXX");
            if(data)
            {
                $("body").find("span[name]").each(function(){
                    var name = $(this).attr("name");
                    var text = data[name];
                    $(this).text(text);
                })
            }
        }

        function initView() {
            /**选择星级*/
            var $star = $(".star-box");
            $star.each(function(index) {
                var $li = $(this).find("li");
                var $active = $(this).find("active");
                var i = iScore = iStar = 0;
                $li.click(function() {
                    var index = $(this).index() + 1;
                    iStar = $(this).index() + 1;
                    page_fwpj.curPoint($li, index);
                });
            });
            /**建议反馈获取焦点*/
            $('#tip').click(function() {
                $('#JYFK').focus()
            });
            /**保存按钮*/
            $("#savePjxxBtn").on("click", function(){
                var params = {};
                var data = $("body").data();
                params.fwid = data.fwid;
                params.fwbid = data.fwbid;
                params.qyxxid = data.qyxxid;
                params.fpfwid = data.fpfwid;
                params.jyfk = $("#JYFK").val();
                $(".star-box").each(function(){
                    var name = $(this).attr("name");
                    params[name] = $(this).find("li[class*='active']").length;
                })
                $.QuickRemote.AjaxJson({funcName:"/api/gzd/qyfw/savePjxx", callback:function(result){
                    $.QuickAlert.alertNormal("保存评价成功", {callback: function(){
                        history.back(-1);
                    }});
                },params: params});
            });
        }

        function curPoint($li, pNum) {
            if (pNum) {
                iScore = pNum;
            } else {
                iScore = iStar;
            }
            for (i = 0; i < $li.length; i++) {
                if (i < iScore) {
                    $li.eq(i).addClass("active");
                } else {
                    $li.eq(i).removeClass("active");
                }
            }
        }

        function clearText(obj) {
            $('#tip').hide();
        }
        function text(obj) {
            if (obj.value == "") {
                $('#tip').show();
            }
        }

        var cfg_def = {
            initView: initView,
            setDpjfwxx: setDpjfwxx,
            curPoint: curPoint,
            clearText: clearText,
            text: text,
        }

        page_fwpj.init = function(cfg){
            $.extend(page_fwpj, cfg_def, cfg);
            page_fwpj.initView();
            page_fwpj.setDpjfwxx();
            $('#JYFK').focus(page_fwpj.clearText)
            $('#JYFK').blur(page_fwpj.text)
        }

        return page_fwpj;
    })(jQuery, {});
    
</script>

</html>











